package day6;

import java.util.Scanner;

public class Main {
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int w = in.nextInt();
            int h = in.nextInt();
            int count = 0;
            int[][] array = new int[w][h];
            for(int i = 0; i < w; i++) {
                for(int j = 0; j < h; j++) {
                    array[i][j] = 1;
                }
            }
            for(int i = 0; i < w; i++) {
                for(int j = 0; j < h; j++) {
                    if(array[i][j] == 1) {
                        count++;
                        if(i+2 < w) {
                            array[i+2][j] = 0;
                        }
                        if(j+2 < h) {
                            array[i][j+2] = 0;
                        }
                    }
                }
            }

            System.out.println(count);
        }
    }
    public static int StrToInt(String str) {
        int len = str.length();
        if(len == 0) {
            return 0;
        }
        int num = 0;
        char c = '-';
        int min = 0;
        if(str.charAt(0) == '-' || str.charAt(0) == '+') {
            min = 1;
        }
        for(int i = len -1; i >= min; i--) {
            int num1 = 0;
            if(str.charAt(i) < '0' || str.charAt(i) > '9') {
                return 0;
            }

            num1 = str.charAt(i) - 48;
            for(int j = len - i -1; j > 0; j--) {
                num1 = num1 * 10;
            }
            num = num1 + num;

        }
        if(str.charAt(0) == '-') {
            num = -num;
        }

        return num;
    }

    public static void main(String[] args) {
        String str = "";
        int ret = StrToInt(str);
        System.out.println(ret);
    }
    public static int StrToInt2(String str) {
        char[] chs = str.toCharArray();
        if(str.isEmpty()) {
            return 0;
        }
        int symbol = 1;
        if(chs[0] == '-') {
            symbol = -1;
            chs[0] = '0';
        }else if(chs[0] == '+') {
            chs[0] = '0';
        }
        int sum = 0;
        for (int i = 0; i < chs.length-1; i++) {
            if(chs[i] < '0' || chs[i] > '9') {
                sum = 0;
                break;
            }
            sum = sum * 10 + chs[i] - '0';
        }
        return sum * symbol;
    }
}
